let request = require('request')
let fs = require('fs')
let qs = require('querystring')
let images = require('images')

let imageBase64 = fs.readFileSync("./1577410144771.jpg").toString("base64")

// console.log(imageBase64)

let url = "https://aiapi.jd.com/jdai/garbageImageSearch?appkey=d985855cde224f4d65788370d68b10b1&timestamp=1577415934&sign=c09c8067dc1d8bd5b9f49697c9787e95"

let body = {
    "cityId": "310000", "imgBase64": imageBase64
}

request({
    url: url,
    method: "POST",
    headers: qs.stringify({
        "Content-Type": "application/json;charset=UTF-8"
    }),
    body: qs.stringify(body)
}, (err, res, body) => {
    console.log(body)
})